#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    ios::sync_with_stdio(false);
    cin.tie(0);  cout.tie(0);
    int m;cin>>m;
    vector<int> dinos;
    int cnt = 0;
    for(int i=0;i<m;i++){
        int x;cin>>x;
        dinos.push_back(x);
        if(x == 2)cnt++;
    }
    sort(dinos.begin(),dinos.end());
    dinos.push_back(0);
    int n = 0;while(dinos[n] != dinos[0] && n < dinos.size()-1)n++;
    dinos.pop_back();
    for(int i=n;i<dinos.size();){
        if(dinos[i] > dinos[0])
            dinos.erase(dinos.begin());
        else
            i++;
    }
    cout<<dinos.size();
    return 0;
}
